package com.woniu.user.mapper;

import com.woniu.user.entity.Advice;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author author
 * @create 2021/5/19
 */
@Mapper
public interface AdviceMapper {

    //新增建议
    @Insert("insert into advice values(default,#{title},#{content},#{aDate},1,null")
    boolean addAdvice(Advice advice);

    //修改建议状态
    @Update("update advice set status = 2 where id = #{id}")
    boolean updateStatusById(Integer id);

    //查询所有建议
    @Select("select * from advice")
    List<Advice> selectAllAdvice();

    //回复消息
    @Update("update advice set reply=#{reply}")
    boolean addReply(String reply);

}
